﻿module.exports.showVotes=function(req,res,params){
	var votes = params;
	if(votes != null && votes.length > 0){
		
		var sum = 0;
		votes.forEach(function(vote){
			sum += vote.voteNum;
		});
		
		console.log('==============sum:'+sum);
		
		/**
		 * 每种投票占比例
		 */
		votes.forEach(function(vote){
			var percent = vote.voteNum/sum;
			vote.percent = percent;
		});
		return {'votes':votes};
	}
	return {'votes':null};
}